import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";

import routerList from "@/router/index";

import { flattenDeep } from "@/utils/index";

let routeList: Array<any> = [];

routerList.forEach((e) => {
  routeList.push(e.routeList);
});

routeList = flattenDeep(routeList);

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "baseRoute",
    meta: {
      title: "主页",
    },
    component: () => import("@/views/home.vue"),
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
